home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / byte0787.arc / NEWGEN.ARC / FLOAT.C < prev    next >
Encoding:
Text File  |  1987-01-27  |  896 b   |  35 lines

  1. /* simple benchmark for testing floating point speed of c libraries
  2.    does repeated multiplications and divisions in a loop that is
  3.    large enough to make the looping time insignificant */
  4.  
  5. #define CONST1  3.141597E0
  6. #define CONST2 1.7839032E4
  7. #define COUNT 10000
  8.  
  9. main()
  10.         {
  11.         double a, b, c;
  12.         int i;
  13.  
  14.         a = CONST1;
  15.         b = CONST2;
  16.         for (i = 0; i < COUNT; ++i)
  17.                 {
  18.                 c = a * b;
  19.                 c = c / a;
  20.                 c = a * b;
  21.                 c = c / a;
  22.                 c = a * b;
  23.                 c = c / a;
  24.                 c = a * b;
  25.                 c = c / a;
  26.                 c = a * b;
  27.                 c = c / a;
  28.                 c = a * b;
  29.                 c = c / a;
  30.                 c = a * b;
  31.                 c = c / a;
  32.                 }
  33.         printf ("Done\n");
  34.         }